package application;

import chis.fx.stage.BorderPaneStage;
import chis.fx.stage.CircleStage;
import chis.fx.stage.FlowPaneStage;
import chis.fx.stage.NewStage;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;


public class Main extends Application {

	private BorderPane root;
	private Scene scene;

	@Override
	public void start(Stage primaryStage) {

		try {
			root = new BorderPane();
			scene = new Scene(root,400,400);
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			addComponentsToStage();
			primaryStage.setScene(scene);
			
			
			
			
			
			primaryStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}


		
	}

	public static void main(String[] args) {
		launch(args);
	}

	public void addComponentsToStage() {
		addCircleStageLauncher();
		addNewStageLauncher();
		addFlowPaneStageLauncher();
		addBorderPaneStageLauncher();
	}

	private void addCircleStageLauncher() {
		Button button = new Button();
		button.setText("Click here to see the circles");
		button.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				final CircleStage stage = new CircleStage();
				stage.show();
			}
		});
		root.setCenter(button);
	}
	
	private void addNewStageLauncher() {
		Button button = new Button();
		button.setText("Click here to see the stuff");
		button.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				final NewStage stage = new NewStage();
				stage.show();
			}
		});
		root.setTop(button);
	}
	
	private void addFlowPaneStageLauncher() {
		Button button = new Button();
		button.setText("Click here to see the flowpane stage");
		button.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				final FlowPaneStage stage = new FlowPaneStage();
				stage.show();
			}
		});
		root.setBottom(button);
	}
	
	private void addBorderPaneStageLauncher() {
		Button button = new Button();
		button.setText("Click here to see the borderpane stage");
		button.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				final BorderPaneStage stage = new BorderPaneStage(4);
				stage.show();
			}
		});
		root.setRight(button);
	}

	

}
